#ifndef _CONFIG_H
#define _CONFIG_H

#include "Log.h"
#include "ConfigFile.h"

class Config {
public:    
    static const int DISTORTE_NUM = 15;

    static void init(const string &configFilePath) {
        s_configFilePath = configFilePath;
    }

    static Config& getInstance() {
        static Config _instance;
        return _instance;
    }

    const char * getLocale() {
        return m_locale.c_str();
    }

    float getRegionIgnoreDown() const {
        return m_regionIgnoreDown;
    }

    float getRegionIgnoreUp() const {
        return m_regionIgnoreUp;
    }

    string getModelPath() const {
        return m_modelPath;
    }

    string getDataDirPath() const {
        return m_dataDirPath;
    }

    const char * getKeywordPath() const {
        return m_keywordPath;
    }

    string getString(const char *key) const {
        return m_configFile->getString(key);
    }

private:
    static string s_configFilePath;
    
    ConfigFile *m_configFile;

    string m_locale;

    string m_dataDirPath;
    string m_modelPath;

    const char *m_keywordPath;

    float m_regionIgnoreUp;
    float m_regionIgnoreDown;

    Config();
    
    ~Config(void) {
        delete m_configFile;
    }
    
    Config(const Config&);
    Config& operator= (const Config &);
    
};

#endif
